@IsTest
private class MassUpdateAddressControllerTest{

    private static Account setupAccount(){
        Account account = new Account();
        account.name = 'testAccount';
        account.billingCity = 'TestTokyo';
        account.billingStreet = 'Test1111';
        insert account;
        
        Contact con1 = new Contact();
        con1.firstname = 'testContact1';
        con1.lastname = 'testContact1';
        con1.accountId = account.Id;
        con1.mailingCity = 'WrongTest2';
        con1.mailingStreet = 'WrongTest2';
        insert con1;
        
        Contact con2 = new Contact();
        con2.firstname = 'testContact2';
        con2.lastname = 'testContact2';
        con2.accountId = account.Id;
        con1.mailingCity = 'WrongTest2';
        con1.mailingStreet = 'WrongTest2';
        insert con2;
        
        Contact con3 = new Contact();
        con3.firstname = 'testContact3';
        con3.lastname = 'testContact3';
        con3.accountId = account.Id;
        insert con3;
        
        
        return account;
    }
    

    @IsTest
    private static void massupdateTest(){

        Account account = setupAccount();
        Test.starttest();

        ApexPages.StandardController standardController = new ApexPages.StandardController(account);
        MassUpdateAddressController controller = new MassUpdateAddressController(standardController);

        controller.contactCheckList[0].isupdate = true;
        controller.contactCheckList[1].isupdate = true;

        controller.massupdate();

        System.assertEquals(controller.contactCheckList[0].contact.mailingcity,controller.account.billingcity);
        System.assertEquals(controller.contactCheckList[1].contact.mailingstreet,controller.account.billingstreet);

        Test.stopTest();

    }
}